import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
import java.util.*;

public class TraCuuDT_Client {
	public TraCuuDT_Client() {
	}

	public static void main(String args[]) {
		TraCuuDTClient_GUI dg = new TraCuuDTClient_GUI(
				"TRƯỜNG THPT HUỲNH NGỌC HUỆ");
		dg.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		dg.pack();
		dg.setVisible(true);
		
	}
}

final class TraCuuDTClient_GUI extends JFrame implements ActionListener {

	private Container contentPane = getContentPane();
	private GridBagLayout gbL = new GridBagLayout();
	private GridBagConstraints gbC = new GridBagConstraints();
	public JPanel mainPane = new JPanel(gbL);
	private JMenuItem mntAbout = new JMenuItem("About");
	private JMenuItem mntExit = new JMenuItem("Exit");
	private JButton cmdTraCuu, cmdLamLai;
	private JTextField txtMaHS;
	public Choice hocki, namhoc;

	public TraCuuDTClient_GUI(String title) {
		super(title);
		Gui();
	}

	/*
 * 
 *
 */
	public void actionPerformed(ActionEvent e) {
		Object ob = e.getSource();
		if (ob == mntExit) {
			System.exit(0);
		}
		if (ob == mntAbout) {
			JOptionPane.showMessageDialog(this,
					"Copyright (c) 2009-2010 Mainsoft \n" + "Võ Thị Phương",
					"About PNV Admin!", JOptionPane.INFORMATION_MESSAGE);
		}
		if (ob == cmdTraCuu) {
			// se lam gi o nut nay???
		}
	}

	/*
	 * ham tao ra giao dien cho Client vao: ra:
	 */
	public void Gui() {
		hocki = new Choice();
		namhoc = new Choice();
		// goi den Server

		JMenu mnuFile = new JMenu("File");
		mnuFile.add(mntExit);
		JMenu mnuHelp = new JMenu("Help");
		mnuHelp.add(mntAbout);

		JMenuBar mb = new JMenuBar();
		setJMenuBar(mb);
		mb.add(mnuFile);
		mb.add(mnuHelp);

		mainPane.setBackground(new Color(100, 0, 200));
		contentPane.setBackground(new Color(255, 0, 100));

		gbC.fill = GridBagConstraints.BOTH;
		contentPane
				.add(new JLabel(
						"HỆ THỐNG TRA CỨU ĐIỂM TRƯỜNG THPT HUỲNH NGỌC HUỆ - ĐẠI LỘC - QUẢNG NAM",
						JLabel.CENTER), BorderLayout.NORTH);
		addComponent(new JLabel("Mã Học sinh:", JLabel.LEFT), 0, 2, 2, 1);
		addComponent(txtMaHS = new JTextField(3), 0, 5, 2, 1);
		addComponent(new JLabel("Học Kỳ:", JLabel.LEFT), 1, 2, 2, 1);
		addComponent(hocki, 1, 5, 2, 1);
		addComponent(new JLabel("Năm Học:", JLabel.LEFT), 2, 2, 2, 1);
		addComponent(namhoc, 2, 5, 2, 1);
		addComponent(cmdLamLai = new JButton("Làm Lại"), 3, 2, 2, 1);
		addComponent(cmdTraCuu = new JButton("Tra Cứu"), 3, 5, 2, 1);

		mntAbout.addActionListener(this);
		mntExit.addActionListener(this);
		cmdLamLai.addActionListener(this);
		cmdTraCuu.addActionListener(this);

		contentPane.add(mainPane, BorderLayout.CENTER);
	}

	public void addComponent(Component c, int row, int column, int width,
			int height) {
		gbC.gridx = column;
		gbC.gridy = row;
		gbC.gridwidth = width;
		gbC.gridheight = height;
		gbL.setConstraints(c, gbC);
		mainPane.add(c);
	}
}

